<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 
            nth-of-type(n) 匹配一组元素中任意位置的元素(从前向后匹配)
            nth-last-child(n) 匹配一组元素中任意位置的元素（从后相亲啊匹配）
            不考虑其他兄弟元素，只匹配选择器选中的元素
            n: 0,1,2,3...
            2n: 0.2.4.6...
            2n+1: 1,3,5,7...
        */
        /* ul li:nth-of-type(2) {
            color: red;
        }
        span:nth-of-type(2) {
            color: red;
        } */
        /* ul li:nth-last-of-type(2n) {
            color: red;
        }
        span:nth-last-of-type(2n+1) {
            color: red;
        } */
        ul li:first-of-type {
            color: red;
        }
        ul li:last-of-type {
            color: blue;
        }
        span:first-of-type {
            color: red;
        }
        span:last-of-type {
            color: blue;
        }
    </style>
</head>
<body>
    <ul>
        <li>111111111111</li>
        <li>111111111111</li>
        <li>111111111111</li>
        <li>111111111111</li>
        <li>111111111111</li>
    </ul>
    <span>2222222</span>
    <div>3333333333</div>
    <span>44444444</span>
    <div>5555555555</div>
    <span>666666666</span>
    <div>777777777777</div>
</body>
</html>